import Vue from 'vue';
import Router from 'vue-router';
import modulesRoutes from './modules';

Vue.use(Router);

export const constantRoutes = modulesRoutes;
// console.log(constantRoutes);
export const createRouter = (routers) =>
  new Router({
    scrollBehavior: () => ({
      y: 0
    }),
    linkActiveClass: 'nest-active',
    routes: routers
  });
export const router = createRouter(constantRoutes);

export function resetRouter(routes) {
  const newRouter = createRouter(routes);
  router.matcher = newRouter.matcher; // reset router
}

export default router;
